<?php
$id=$_GET['id'];
$mproduct= new Model_Products();

if(isset($_POST['ok'])){
	$data=array(
			"`name`" => $_POST['name'],
			"`desc`" => $_POST['desc'],
			"`thumb`"=> '',
			"`thumbnail`"=>'',
			"`image`"=>'',
			"`image1`"=>'',
			"`image2`"=>'',
			"`image3`"=>'',
			"`image4`"=>'',
			"`image1_thumb`"=>'',
			"`image2_thumb`"=>'',
			"`image3_thumb`"=>'',
			"`image4_thumb`"=>'',
			"`price`"=>$_POST['price'],
			"`price_origin`"=>$_POST['price_origin'],
			"`quantity`"=>$_POST['quantity'],	
			"`origin` "=> $_POST['origin'],
			"`warranty`"=> $_POST['warranty'],
			"`status` "=> $_POST['status'],
			"`modified_date`"=> '',
			"`detail`"=> $_POST['detail'],
			"`product_relate`"=> '',
			"`created_date`"=> '',
			"`category_id`"=> $_POST['category'],
			"`price_add`"=>'',
			
		);
		$mproduct= new Model_Products;
		
		$mproduct->update_product($data,$id);
		redirect(BASE_URL."/index.php?module=product&act=list");
	
}
$mcategory= new Model_Categories;
$data=$mcategory->listall();
$data['info']=$mproduct->get_product($id);
loadview("product/edit_view",$data);